<form class="layui-form" method="post">
    <div class="layui-form-item" style="padding-top: 2%">
        <label class="layui-form-label">任务平台</label>
        <div class="layui-inline">
            <volist name="sitedao" id="site">
                <input type="checkbox" name="site[{$site['site_id']}]" value="{$site['site_name']}" title="{$site['site_name']}">
            </volist>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="register">立即提交</button>
        </div>
    </div>
</form>
<script>
    form.render('checkbox');
        form.on('submit(register)', function(data){
            var datafield= data.field;
            var url = "__SELF__";
            $.post(url,datafield,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }else if(data.code == '101'){
                    layer.msg(data.msg, {
                        icon: 6,
                        time: 2000
                    }, function(){
                        location.reload();
                    });
                }
            });

            return false;
        });

</script>